<?php
declare (strict_types = 1);

namespace app\middleware;

class Check2
{
    /**
     * 处理请求
     *
     * @param \think\Request $request
     * @param \Closure       $next
     * @return Response
     */
    public function handle($request, \Closure $next)
    {
        //
        if(empty(session('username')) && !preg_match('/signin/',$request->pathinfo())||session('role')=='admin'){
            return redirect('/signin');
        }
        return $next($request);
    }
}
